Ext.define('Ext.app.XuatKhoWindow', {
    extend: 'Ext.window.Window',
    alias: 'widget.xuatKhoWindow',

    id: 'xuatKhoWindow',
    height: 210,
    width: 400,
    layout: 'fit',
    plain:true,
    items: {
        xtype: 'form',
        layout: 'absolute',
        defaultType: 'textfield',
        border: false,

        items: [{
            fieldLabel: this.translations.get("HOME.DIA_CHI"),
            fieldWidth: 60,
            msgTarget: 'side',
            vtype: 'email',
            x: 5,
            y: 5,
            name: 'to',
            anchor: '-5'  // anchor width by percentage
        }, {
            fieldLabel: 'Subject',
            fieldWidth: 60,
            x: 5,
            y: 35,
            name: 'subject',
            anchor: '-5'  // anchor width by percentage
        }, {
            x:5,
            y: 65,
            xtype: 'textarea',
            style: 'margin:0',
            hideLabel: true,
            name: 'msg',
            anchor: '-5 -5'  // anchor width and height
        }]
    },

    buttons: [{
        text: 'Ok',
        handler: function(button) {
            var wind = button.up('xuatKhoWindow');
            var form = wind.down('form');
            form.submit({
                url: 'XuatKho.jsp',
                waitMsg: "Please wait...",
                success: function(form, action) {
                    wind.close();
                },
                failure: function(form, action) {
                    showErrorMsg(action.result.msg);
                }
            });
        }
    },{
        text: 'Cancel', 
        handler: function(button) {
            var wind = button.up('xuatKhoWindow');
            if(wind != null) {
                wind.close();
            }
        }
    }],
    
    listeners: {
        beforeclose: function () {
            Ext.getBody().unmask();
        }
    },

    initComponent : function() {
        Ext.getBody().mask();
        
        this.callParent();
    }
});
